﻿namespace HRM.CORE
{
    using DevExpress.Data;
    using DevExpress.Utils;
    using DevExpress.XtraBars;
    using DevExpress.XtraBars.Docking;
    using DevExpress.XtraEditors;
    using DevExpress.XtraEditors.Controls;
    using DevExpress.XtraEditors.Repository;
    using DevExpress.XtraGrid;
    using DevExpress.XtraGrid.Columns;
    using DevExpress.XtraGrid.Views.Base;
    using DevExpress.XtraGrid.Views.Grid;
    using APP.HELPER;
    using Common.Base;
    using Common.Class; using APP.HELPER.Utils.Language; using Security.Security; using Dictionary.ERP;
    using HRM.CORE;
    using HRM.CORE.REPORT;
    
    
    using System; using Extra.ERP;
    using System.ComponentModel;
    using System.Drawing;
    using System.Runtime.CompilerServices;
    using System.Windows.Forms; using Common;
    using Security.ERP;

    public class xucSalaryPay : Common.xucBase
    {
        private Bar bar1;
        private BarDockControl barDockControlBottom;
        private BarDockControl barDockControlLeft;
        private BarDockControl barDockControlRight;
        private BarDockControl barDockControlTop;
        private BarManager barManager1;
        private BarEditItem bbeMonth;
        private BarEditItem bbeSalaryName;
        private BarEditItem bbeYear;
        private BarButtonItem bbiAdd;
        private BarButtonItem bbiAdd1;
        private BarButtonItem bbiClose;
        private BarButtonItem bbiCreate;
        private BarButtonItem bbiDelete;
        private BarButtonItem bbiEdit;
        private BarButtonItem bbiExport;
        private BarButtonItem bbiFinish;
        private BarButtonItem bbiFormula;
        private BarButtonItem bbiLock;
        private BarButtonItem bbiOpen;
        private BarButtonItem bbiPrint;
        private BarButtonItem bbiReload;
        private Common.Class.clsAllOption clsAllOption = new Common.Class.clsAllOption();
        private GridColumn colBranchName;
        private GridColumn colDate;
        private GridColumn colDepartmentName;
        private GridColumn colDescription;
        private GridColumn colEmployeeCode;
        private GridColumn colFirstName;
        private GridColumn colGroupName;
        private GridColumn colLastName;
        private GridColumn colMoney;
        private GridColumn colOrder;
        private GridColumn colPayMoney;
        private GridColumn colPerson;
        private GridColumn colRealMoney;
        private GridColumn colReason;
        private GridColumn colSalaryPayID;
        private IContainer components = null;
        private DockManager dockManager1;
        private DockPanel dockPanel1;
        private ControlContainer dockPanel1_Container;
        private FlowLayoutPanel flowLayoutPanel1;
        private FlowLayoutPanel flowLayoutPanel2;
        private FlowLayoutPanel flowLayoutPanel3;
        private GridView gbList;
        private GridControl gcList;
        private GridColumn gridColumn1;
        private GridColumn gridColumn2;
        private AutoHideContainer hideContainerLeft;
        public DevExpress.Utils.ImageCollection imageCollection2;
        private LabelControl lbBranchName;
        private LabelControl lbCompanyName;
        private LabelControl lbDepartmentName;
        private LabelControl lbGroupName;
        private LabelControl lbMessage;
        private LabelControl lbMessage1;
        private LabelControl lbSalaryName;
        private string m_Code = MyLogin.Code;
        private string m_CompanyName = "";
        private string m_EmployeeCode = "";
        private bool m_IsFinish = false;
        private bool m_IsLock = false;
        private int m_Level = MyLogin.Level;
        private int m_Month = 0;
        private Guid m_SalaryTableListID = Guid.Empty;
        private int m_Year = 0;
        private PanelControl panelControl1;
        private PictureBox ptFinish;
        private PictureBox ptLock;
        private RepositoryItemCalcEdit repCalculator;
        private RepositoryItemTimeEdit repMonth;
        private RepositoryItemComboBox repositoryItemComboBox1;
        private RepositoryItemTimeEdit repYear;
        private xucExpandCollapseButton xucExpandCollapseButton1;
        private xucOrganization xucOrganization1;

        public event ClosedHander Closed;

        public event SalaryPayChangedHander SalaryPayChanged;

        public xucSalaryPay()
        {
            this.InitializeComponent();
            this.m_Month = this.clsAllOption.MonthDefault.Month;
            this.m_Year = this.clsAllOption.MonthDefault.Year;
            this.bbeMonth.EditValue = this.clsAllOption.MonthDefault;
            this.bbeYear.EditValue = this.clsAllOption.MonthDefault;
            this.Init();
        }

        private void Add()
        {
            xfmSalaryPayAdd add = new xfmSalaryPayAdd(Actions.Add, this.m_SalaryTableListID);
            add.Added += new xfmSalaryPayAdd.AddedEventHander(this.frm_Added);
            add.ShowDialog();
        }

        private void AddRow(HRM_SALARY_PAY item)
        {
            GridView gbList = this.gbList;
            int focusedRowHandle = gbList.FocusedRowHandle;
            gbList.AddNewRow();
            focusedRowHandle = gbList.FocusedRowHandle;
            gbList.SetRowCellValue(focusedRowHandle, "EmployeeCode", item.EmployeeCode);
            HRM_EMPLOYEE hrm_employee = new HRM_EMPLOYEE();
            hrm_employee.Get(item.EmployeeCode);
            gbList.SetRowCellValue(focusedRowHandle, "FirstName", hrm_employee.FirstName);
            gbList.SetRowCellValue(focusedRowHandle, "LastName", hrm_employee.LastName);
            gbList.SetRowCellValue(focusedRowHandle, "Order", item.Order);
            gbList.SetRowCellValue(focusedRowHandle, "Reason", item.Reason);
            gbList.SetRowCellValue(focusedRowHandle, "Date", item.Date);
            gbList.SetRowCellValue(focusedRowHandle, "Money", item.Money);
            gbList.SetRowCellValue(focusedRowHandle, "PayMoney", item.PayMoney);
            gbList.SetRowCellValue(focusedRowHandle, "RealMoney", item.RealMoney);
            gbList.SetRowCellValue(focusedRowHandle, "Person", item.Person);
            gbList.SetRowCellValue(focusedRowHandle, "Description", item.Description);
            gbList.UpdateCurrentRow();
        }

        private void bbiAdd_ItemClick(object sender, ItemClickEventArgs e)
        {
            if (!MyRule.IsAdd("bbiSalaryPay"))
            {
                MyRule.Notify();
            }
            else
            {
                this.CreateTableSalary();
            }
        }

        private void bbiAdd1_ItemClick(object sender, ItemClickEventArgs e)
        {
            if (!MyRule.IsAdd("bbiSalaryPay"))
            {
                MyRule.Notify();
            }
            else
            {
                this.Add();
            }
        }

        private void bbiClose_ItemClick(object sender, ItemClickEventArgs e)
        {
            this.RaiseClosedHander();
        }

        private void bbiCreate_ItemClick(object sender, ItemClickEventArgs e)
        {
            xfmSalaryPayOption option = new xfmSalaryPayOption();
            option.Created += new xfmSalaryPayOption.CreatedHander(this.xfm_Created);
            option.ShowDialog();
        }

        private void bbiDelete_ItemClick(object sender, ItemClickEventArgs e)
        {
            this.Delete();
        }

        private void bbiEdit_ItemClick(object sender, ItemClickEventArgs e)
        {
            if (!MyRule.IsEdit("bbiSalaryPay"))
            {
                MyRule.Notify();
            }
            else
            {
                this.Change();
            }
        }

        private void bbiExport_ItemClick(object sender, ItemClickEventArgs e)
        {
            if (!MyRule.IsExport("bbiSalaryPay"))
            {
                MyRule.Notify();
            }
            else
            {
                base._exportView = this.gbList;
                SYS_LOG.Insert("Bảng Lương", "Xuất");
                base.Export();
            }
        }

        private void bbiFinish_ItemClick(object sender, ItemClickEventArgs e)
        {
            if (!MyRule.IsEdit("bbiSalaryPay"))
            {
                MyRule.Notify();
            }
            else if (!ClsOption.System2.IsQuestion || (XtraMessageBox.Show("Bạn c\x00f3 chắc l\x00e0 muốn thực hiện t\x00e1c vụ n\x00e0y kh\x00f4ng?" + Environment.NewLine + " T\x00e1c vụ n\x00e0y được hiểu l\x00e0 bạn đ\x00e3 ho\x00e0n th\x00e0nh bảng t\x00ednh lương của th\x00e1ng n\x00e0y!", "Th\x00f4ng b\x00e1o", MessageBoxButtons.YesNo, MessageBoxIcon.Question) != DialogResult.No))
            {
                HRM_SALARY_TABLELIST hrm_salary_tablelist = new HRM_SALARY_TABLELIST();
                if (hrm_salary_tablelist.Finish(this.m_SalaryTableListID).ToString() == "OK")
                {
                    this.m_IsLock = true;
                    this.m_IsFinish = true;
                    this.InitInterface();
                }
                else
                {
                    MessageBox.Show("Fail!");
                }
            }
        }

        private void bbiLock_ItemClick(object sender, ItemClickEventArgs e)
        {
            if (!MyRule.IsEdit("bbiSalaryPay"))
            {
                MyRule.Notify();
            }
            else
            {
                HRM_SALARY_TABLELIST hrm_salary_tablelist = new HRM_SALARY_TABLELIST();
                if (hrm_salary_tablelist.Lock(this.m_SalaryTableListID).ToString() == "OK")
                {
                    this.m_IsLock = true;
                    this.InitInterface();
                }
                else
                {
                    MessageBox.Show("Fail!");
                }
            }
        }

        private void bbiOpen_ItemClick(object sender, ItemClickEventArgs e)
        {
            if (!MyRule.IsEdit("bbiSalaryPay"))
            {
                MyRule.Notify();
            }
            else
            {
                HRM_SALARY_TABLELIST hrm_salary_tablelist = new HRM_SALARY_TABLELIST();
                if (hrm_salary_tablelist.Open(this.m_SalaryTableListID).ToString() == "OK")
                {
                    this.m_IsLock = false;
                    this.InitInterface();
                }
                else
                {
                    MessageBox.Show("Fail!");
                }
            }
        }

        private void bbiPrint_ItemClick(object sender, ItemClickEventArgs e)
        {
            if (!MyRule.IsPrint("bbiSalaryPay"))
            {
                MyRule.Notify();
            }
            else
            {
                new xfmOptionPrintSalaryPay(this.m_Level, this.m_Code, this.m_Month, this.m_Year).ShowDialog();
            }
        }

        private void bbiRecal_ItemClick(object sender, ItemClickEventArgs e)
        {
        }

        private void bbiReload_ItemClick(object sender, ItemClickEventArgs e)
        {
            this.Reload();
        }

        private void Change()
        {
            if (MyRule.IsAccess("bbiEmployee"))
            {
                HRM_SALARY_PAY item = new HRM_SALARY_PAY();
                object focusedRowCellValue = this.gbList.GetFocusedRowCellValue("EmployeeCode");
                object obj3 = this.gbList.GetFocusedRowCellValue("SalaryPayID");
                if ((focusedRowCellValue != null) && (obj3 != null))
                {
                    base.SetWaitDialogCaption("Đang kiểm tra dữ liệu....");
                    if (item.Get(this.m_SalaryTableListID, focusedRowCellValue.ToString(), obj3.ToString()) != "OK")
                    {
                        this.DoHide();
                        XtraMessageBox.Show("Dữ liệu kh\x00f4ng tồn tại", "Th\x00f4ng B\x00e1o", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    }
                    else
                    {
                        this.DoHide();
                        xfmSalaryPayAdd add = new xfmSalaryPayAdd(Actions.Update, item);
                        add.Updated += new xfmSalaryPayAdd.UpdatedEventHander(this.frm_Updated);
                        add.Added += new xfmSalaryPayAdd.AddedEventHander(this.frm_Added);
                        add.ShowDialog();
                    }
                }
            }
        }

        private void CreateTableSalary()
        {
            Options.SetWaitDialogCaption("Đang khởi tạo dữ liệu...");
            HRM_TIMEKEEPER_TABLELIST hrm_timekeeper_tablelist = new HRM_TIMEKEEPER_TABLELIST();
            if (!hrm_timekeeper_tablelist.Exist(this.m_Month, this.m_Year))
            {
                MessageBox.Show("Bảng chấm c\x00f4ng th\x00e1ng n\x00e0y chưa được khởi tạo! Vui l\x00f2ng tạo bảng chấm c\x00f4ng trước khi thực hiện t\x00ednh lương!");
                Options.HideDialog();
            }
            else
            {
                HRM_SALARY_TABLELIST hrm_salary_tablelist = new HRM_SALARY_TABLELIST();
                DIC_SALARY_FORMULA dic_salary_formula = new DIC_SALARY_FORMULA();
                dic_salary_formula.Get();
                if (!hrm_salary_tablelist.Exist(this.m_Month, this.m_Year))
                {
                    this.m_SalaryTableListID = Guid.NewGuid();
                    if (hrm_salary_tablelist.Insert(this.m_SalaryTableListID.ToString(), this.bbeSalaryName.EditValue.ToString(), this.m_Month, this.m_Year, dic_salary_formula.SocialInsurance, dic_salary_formula.HealthInsurance, dic_salary_formula.UnemploymentInsurance, dic_salary_formula.SocialInsurance1, dic_salary_formula.HealthInsurance1, dic_salary_formula.UnemploymentInsurance1, dic_salary_formula.OvertimeSaturdayType, false, false) == "OK")
                    {
                        HRM_SALARY.Create(this.m_Level, this.m_Code, this.m_SalaryTableListID.ToString(), this.bbeSalaryName.EditValue.ToString(), this.m_Month, this.m_Year);
                    }
                }
                this.bbiAdd.Visibility = BarItemVisibility.Never;
                this.bbiCreate.Visibility = BarItemVisibility.Always;
                this.bbiLock.Enabled = true;
                this.bbiOpen.Enabled = true;
                this.bbiFinish.Enabled = true;
                this.bbiAdd1.Enabled = true;
                this.bbiEdit.Enabled = true;
                this.bbiDelete.Enabled = true;
                this.lbMessage1.Visible = false;
                hrm_salary_tablelist.Get(this.m_Month, this.m_Year);
                this.m_SalaryTableListID = hrm_salary_tablelist.SalaryTableListID;
                this.gcList.DataSource = new HRM_SALARY_PAY().GetList(this.m_Level, this.m_Code, this.m_SalaryTableListID);
                Options.HideDialog();
            }
        }

        private void Delete()
        {
            if (!MyRule.IsDelete("bbiSalaryPay"))
            {
                MyRule.Notify();
            }
            else
            {
                bool flag = false;
                int[] selectedRows = this.gbList.GetSelectedRows();
                if (XtraMessageBox.Show("Bạn c\x00f3 muốn x\x00f3a kh\x00f4ng?", "Th\x00f4ng b\x00e1o", MessageBoxButtons.YesNo, MessageBoxIcon.Question) != DialogResult.No)
                {
                    string str;
                    object rowCellValue;
                    object focusedRowCellValue;
                    base.SetWaitDialogCaption("Đang x\x00f3a...");
                    HRM_SALARY_PAY hrm_salary_pay = new HRM_SALARY_PAY();
                    for (int i = selectedRows.Length; i > 0; i--)
                    {
                        flag = true;
                        rowCellValue = this.gbList.GetRowCellValue(selectedRows[i - 1], "EmployeeCode");
                        focusedRowCellValue = this.gbList.GetRowCellValue(selectedRows[i - 1], "SalaryPayID");
                        if ((rowCellValue != null) && (focusedRowCellValue != null))
                        {
                            SYS_LOG.Insert("Thanh To\x00e1n Lương", "Xo\x00e1", focusedRowCellValue.ToString());
                            str = hrm_salary_pay.Delete(this.m_SalaryTableListID, rowCellValue.ToString(), new Guid(focusedRowCellValue.ToString()));
                            if (str == "OK")
                            {
                                this.gbList.DeleteRow(selectedRows[i - 1]);
                            }
                            else if (str != "OK")
                            {
                                MessageBox.Show("Th\x00f4ng tin kh\x00f4ng được x\x00f3a" + str, "Th\x00f4ng b\x00e1o", MessageBoxButtons.OK, MessageBoxIcon.Hand);
                            }
                        }
                    }
                    this.DoHide();
                    if (!flag && (hrm_salary_pay.GetList(this.m_Level, this.m_Code, this.m_SalaryTableListID).Rows.Count != 0))
                    {
                        rowCellValue = this.gbList.GetFocusedRowCellValue("EmployeeCode");
                        focusedRowCellValue = this.gbList.GetFocusedRowCellValue("SalaryPayID");
                        if ((rowCellValue != null) && (focusedRowCellValue != null))
                        {
                            SYS_LOG.Insert("Thanh To\x00e1n Lương", "Xo\x00e1", focusedRowCellValue.ToString());
                            base.SetWaitDialogCaption("Đang x\x00f3a...");
                            str = hrm_salary_pay.Delete(this.m_SalaryTableListID, rowCellValue.ToString(), new Guid(focusedRowCellValue.ToString()));
                            if (str == "OK")
                            {
                                this.gbList.DeleteRow(this.gbList.FocusedRowHandle);
                            }
                            else if (str != "OK")
                            {
                                MessageBox.Show("Th\x00f4ng tin kh\x00f4ng được x\x00f3a\r\n" + str, "Th\x00f4ng b\x00e1o", MessageBoxButtons.OK, MessageBoxIcon.Hand);
                            }
                            this.DoHide();
                        }
                    }
                }
            }
        }

        protected override void Dispose(bool disposing)
        {
            if (disposing && (this.components != null))
            {
                this.components.Dispose();
            }
            base.Dispose(disposing);
        }

        private void frm_Added(object sender, HRM_SALARY_PAY Item)
        {
            this.LoadGrid(this.m_Level, this.m_Code);
        }

        private void frm_Updated(object sender, HRM_SALARY_PAY Item)
        {
            this.UpdateRow(Item);
        }

        private void gbList_CustomDrawRowIndicator(object sender, RowIndicatorCustomDrawEventArgs e)
        {
            if (e.RowHandle == -2147483648)
            {
                e.Handled = true;
                e.Painter.DrawObject(e.Info);
                Rectangle bounds = e.Bounds;
                e.Graphics.FillRectangle(new SolidBrush(Color.FromArgb(0x3f, 0xa5, 0xa5, 0)), bounds);
                bounds.Height--;
                bounds.Width--;
                e.Graphics.DrawRectangle(Pens.Blue, bounds);
            }
            int rowHandle = e.RowHandle;
            if (rowHandle >= 0)
            {
                rowHandle++;
                e.Info.DisplayText = rowHandle.ToString();
            }
        }

        private void gbList_DoubleClick(object sender, EventArgs e)
        {
            if ((this.gbList.RowCount != 0) && this.bbiEdit.Enabled)
            {
                this.Change();
            }
        }

        private void gbList_FocusedRowChanged(object sender, FocusedRowChangedEventArgs e)
        {
        }

        private void gbList_KeyDown(object sender, KeyEventArgs e)
        {
            this.ucList_ListKeyDown(sender, e);
            if ((e.KeyCode == Keys.Delete) && (this.gbList.RowCount != 0))
            {
                this.Delete();
            }
        }

        private void gbList_MouseDown(object sender, MouseEventArgs e)
        {
            if (e.Button == MouseButtons.Left)
            {
                base.DoShowMenu(this.gbList.CalcHitInfo(new Point(e.X, e.Y)), this.gbList);
            }
        }

        private void Init()
        {
            base.SetWaitDialogCaption("Đang khởi tạo dữ liệu....");
            //if (MyInfo.Get(MyEncryption.Encrypt("ERP01", "123654", true)) == "OK")
            {
                this.lbCompanyName.Text = this.m_CompanyName = "";// MyInfo.Company;
            }
            this.lbBranchName.Text = "";
            this.lbDepartmentName.Text = "";
            this.lbGroupName.Text = "";
            this.LoadSalaryMonth();
            this.repMonth.EditValueChanging += new ChangingEventHandler(this.repMonth_EditValueChanging);
            this.repMonth.EditValueChanged += new EventHandler(this.repMonth_EditValueChanged);
            this.repYear.EditValueChanging += new ChangingEventHandler(this.repYear_EditValueChanging);
            this.repYear.EditValueChanged += new EventHandler(this.repYear_EditValueChanged);
            this.xucOrganization1.LoadData();
            this.xucOrganization1.Selected += delegate (object s, Organization o) {
                HRM_GROUP hrm_group = new HRM_GROUP();
                HRM_DEPARTMENT hrm_department = new HRM_DEPARTMENT();
                HRM_BRANCH hrm_branch = new HRM_BRANCH();
                if (o.Level == 0)
                {
                    this.LoadGrid(this.m_Level = 0, this.m_Code = "");
                    this.lbCompanyName.Text = this.m_CompanyName;
                    this.lbBranchName.Text = "";
                    this.lbDepartmentName.Text = "";
                    this.lbGroupName.Text = "";
                }
                else if (o.Level == 1)
                {
                    this.LoadGrid(this.m_Level = 1, this.m_Code = o.BranchCode);
                    hrm_branch.Get(o.BranchCode);
                    this.lbCompanyName.Text = "";
                    this.lbBranchName.Text = hrm_branch.BranchName;
                    this.lbDepartmentName.Text = "";
                    this.lbGroupName.Text = "";
                }
                else if (o.Level == 2)
                {
                    this.LoadGrid(this.m_Level = 2, this.m_Code = o.DepartmentCode);
                    hrm_department.Get(o.DepartmentCode);
                    this.lbCompanyName.Text = "";
                    this.lbBranchName.Text = hrm_department.BranchName;
                    this.lbDepartmentName.Text = hrm_department.DepartmentName;
                    this.lbGroupName.Text = "";
                }
                else if (o.Level == 3)
                {
                    this.LoadGrid(this.m_Level = 3, this.m_Code = o.GroupCode);
                    hrm_group.Get(o.GroupCode);
                    hrm_department.Get(hrm_group.DepartmentCode);
                    this.lbCompanyName.Text = "";
                    this.lbBranchName.Text = hrm_department.BranchName;
                    this.lbDepartmentName.Text = hrm_department.DepartmentName;
                    this.lbGroupName.Text = "/ " + hrm_group.GroupName;
                }
            };
            this.xucOrganization1.Updated += o => this.xucOrganization1.LoadData();
            this.DoHide();
        }

        private void InitializeComponent()
        {
            this.components = new Container();
            SerializableAppearanceObject appearance = new SerializableAppearanceObject();
            MenuButton button = new MenuButton();
            ItemCommand command = new ItemCommand();
            ItemCommand command2 = new ItemCommand();
            ItemCommand command3 = new ItemCommand();
            ItemCommand command4 = new ItemCommand();
            ItemCommand command5 = new ItemCommand();
            ItemCommand command6 = new ItemCommand();
            ItemCommand command7 = new ItemCommand();
            ItemCommand command8 = new ItemCommand();
            ItemCommand command9 = new ItemCommand();
            ItemCommand command10 = new ItemCommand();
            ItemCommand command11 = new ItemCommand();
            ItemCommand command12 = new ItemCommand();
            ItemCommand command13 = new ItemCommand();
            ItemCommand command14 = new ItemCommand();
            ItemCommand command15 = new ItemCommand();
            ItemCommand command16 = new ItemCommand();
            ItemCommand command17 = new ItemCommand();
            ItemCommand command18 = new ItemCommand();
            ItemCommand command19 = new ItemCommand();
            ItemCommand command20 = new ItemCommand();
            ItemCommand command21 = new ItemCommand();
            ItemCommand command22 = new ItemCommand();
            ItemCommand command23 = new ItemCommand();
            ItemCommand command24 = new ItemCommand();
            ItemCommand command25 = new ItemCommand();
            ItemCommand command26 = new ItemCommand();
            ItemCommand command27 = new ItemCommand();
            ItemCommand command28 = new ItemCommand();
            ItemCommand command29 = new ItemCommand();
            ComponentResourceManager manager = new ComponentResourceManager(typeof(xucSalaryPay));
            this.barManager1 = new BarManager(this.components);
            this.bar1 = new Bar();
            this.bbiAdd1 = new BarButtonItem();
            this.bbiDelete = new BarButtonItem();
            this.bbiEdit = new BarButtonItem();
            this.bbeMonth = new BarEditItem();
            this.repMonth = new RepositoryItemTimeEdit();
            this.bbeYear = new BarEditItem();
            this.repYear = new RepositoryItemTimeEdit();
            this.bbeSalaryName = new BarEditItem();
            this.repositoryItemComboBox1 = new RepositoryItemComboBox();
            this.bbiAdd = new BarButtonItem();
            this.bbiCreate = new BarButtonItem();
            this.bbiPrint = new BarButtonItem();
            this.bbiExport = new BarButtonItem();
            this.bbiLock = new BarButtonItem();
            this.bbiOpen = new BarButtonItem();
            this.bbiFinish = new BarButtonItem();
            this.bbiReload = new BarButtonItem();
            this.bbiClose = new BarButtonItem();
            this.barDockControlTop = new BarDockControl();
            this.barDockControlBottom = new BarDockControl();
            this.barDockControlLeft = new BarDockControl();
            this.barDockControlRight = new BarDockControl();
            this.dockManager1 = new DockManager(this.components);
            this.hideContainerLeft = new AutoHideContainer();
            this.dockPanel1 = new DockPanel();
            this.dockPanel1_Container = new ControlContainer();
            this.xucOrganization1 = new xucOrganization();
            this.imageCollection2 = new DevExpress.Utils.ImageCollection(this.components);
            this.bbiFormula = new BarButtonItem();
            this.gcList = new GridControl();
            this.gbList = new GridView();
            this.colSalaryPayID = new GridColumn();
            this.colEmployeeCode = new GridColumn();
            this.colFirstName = new GridColumn();
            this.colLastName = new GridColumn();
            this.colBranchName = new GridColumn();
            this.colDepartmentName = new GridColumn();
            this.colGroupName = new GridColumn();
            this.colOrder = new GridColumn();
            this.colDate = new GridColumn();
            this.colReason = new GridColumn();
            this.colMoney = new GridColumn();
            this.repCalculator = new RepositoryItemCalcEdit();
            this.colPayMoney = new GridColumn();
            this.colRealMoney = new GridColumn();
            this.colPerson = new GridColumn();
            this.colDescription = new GridColumn();
            this.panelControl1 = new PanelControl();
            this.flowLayoutPanel3 = new FlowLayoutPanel();
            this.xucExpandCollapseButton1 = new xucExpandCollapseButton();
            this.lbGroupName = new LabelControl();
            this.lbDepartmentName = new LabelControl();
            this.flowLayoutPanel2 = new FlowLayoutPanel();
            this.lbBranchName = new LabelControl();
            this.lbCompanyName = new LabelControl();
            this.flowLayoutPanel1 = new FlowLayoutPanel();
            this.lbSalaryName = new LabelControl();
            this.lbMessage1 = new LabelControl();
            this.ptLock = new PictureBox();
            this.ptFinish = new PictureBox();
            this.lbMessage = new LabelControl();
            this.gridColumn1 = new GridColumn();
            this.gridColumn2 = new GridColumn();
            this.barManager1.BeginInit();
            this.repMonth.BeginInit();
            this.repYear.BeginInit();
            this.repositoryItemComboBox1.BeginInit();
            this.dockManager1.BeginInit();
            this.hideContainerLeft.SuspendLayout();
            this.dockPanel1.SuspendLayout();
            this.dockPanel1_Container.SuspendLayout();
            this.imageCollection2.BeginInit();
            this.gcList.BeginInit();
            this.gbList.BeginInit();
            this.repCalculator.BeginInit();
            this.panelControl1.BeginInit();
            this.panelControl1.SuspendLayout();
            this.flowLayoutPanel3.SuspendLayout();
            this.flowLayoutPanel2.SuspendLayout();
            this.flowLayoutPanel1.SuspendLayout();
            ((ISupportInitialize) this.ptLock).BeginInit();
            ((ISupportInitialize) this.ptFinish).BeginInit();
            base.SuspendLayout();
            this.barManager1.Bars.AddRange(new Bar[] { this.bar1 });
            this.barManager1.DockControls.Add(this.barDockControlTop);
            this.barManager1.DockControls.Add(this.barDockControlBottom);
            this.barManager1.DockControls.Add(this.barDockControlLeft);
            this.barManager1.DockControls.Add(this.barDockControlRight);
            this.barManager1.DockManager = this.dockManager1;
            this.barManager1.Form = this;
            this.barManager1.Images = this.imageCollection2;
            this.barManager1.Items.AddRange(new BarItem[] { this.bbiAdd, this.bbiPrint, this.bbiReload, this.bbiLock, this.bbiFormula, this.bbiFinish, this.bbiClose, this.bbeMonth, this.bbeYear, this.bbeSalaryName, this.bbiExport, this.bbiOpen, this.bbiCreate, this.bbiAdd1, this.bbiDelete, this.bbiEdit });
            this.barManager1.MaxItemId = 0x18;
            this.barManager1.RepositoryItems.AddRange(new RepositoryItem[] { this.repMonth, this.repYear, this.repositoryItemComboBox1 });
            this.bar1.BarName = "Tools";
            this.bar1.DockCol = 0;
            this.bar1.DockRow = 0;
            this.bar1.DockStyle = BarDockStyle.Top;
            this.bar1.LinksPersistInfo.AddRange(new LinkPersistInfo[] { new LinkPersistInfo(BarLinkUserDefines.PaintStyle, this.bbiAdd1, "", true, true, true, 0, null, BarItemPaintStyle.CaptionGlyph), new LinkPersistInfo(BarLinkUserDefines.PaintStyle, this.bbiDelete, BarItemPaintStyle.CaptionGlyph), new LinkPersistInfo(BarLinkUserDefines.PaintStyle, this.bbiEdit, BarItemPaintStyle.CaptionGlyph), new LinkPersistInfo(BarLinkUserDefines.PaintStyle, this.bbeMonth, "", true, true, true, 0, null, BarItemPaintStyle.CaptionGlyph), new LinkPersistInfo(BarLinkUserDefines.PaintStyle, this.bbeYear, BarItemPaintStyle.CaptionGlyph), new LinkPersistInfo(this.bbeSalaryName), new LinkPersistInfo(BarLinkUserDefines.PaintStyle, this.bbiAdd, "", true, true, true, 0, null, BarItemPaintStyle.CaptionGlyph), new LinkPersistInfo(BarLinkUserDefines.PaintStyle, this.bbiCreate, "", true, true, true, 0, null, BarItemPaintStyle.CaptionGlyph), new LinkPersistInfo(BarLinkUserDefines.PaintStyle, this.bbiPrint, "", true, true, true, 0, null, BarItemPaintStyle.CaptionGlyph), new LinkPersistInfo(BarLinkUserDefines.PaintStyle, this.bbiExport, BarItemPaintStyle.CaptionGlyph), new LinkPersistInfo(BarLinkUserDefines.PaintStyle, this.bbiLock, "", true, true, true, 0, null, BarItemPaintStyle.CaptionGlyph), new LinkPersistInfo(BarLinkUserDefines.PaintStyle, this.bbiOpen, BarItemPaintStyle.CaptionGlyph), new LinkPersistInfo(BarLinkUserDefines.PaintStyle, this.bbiFinish, BarItemPaintStyle.CaptionGlyph), new LinkPersistInfo(BarLinkUserDefines.PaintStyle, this.bbiReload, "", true, true, true, 0, null, BarItemPaintStyle.CaptionGlyph), new LinkPersistInfo(BarLinkUserDefines.PaintStyle, this.bbiClose, "", true, true, true, 0, null, BarItemPaintStyle.CaptionGlyph) });
            this.bar1.OptionsBar.UseWholeRow = true;
            this.bar1.Text = "Tools";
            this.bbiAdd1.Caption = "Th\x00eam";
            this.bbiAdd1.Enabled = false;
            this.bbiAdd1.Id = 0x15;
            this.bbiAdd1.ImageIndex = 0x45;
            this.bbiAdd1.Name = "bbiAdd1";
            this.bbiAdd1.ItemClick += new ItemClickEventHandler(this.bbiAdd1_ItemClick);
            this.bbiDelete.Caption = "X\x00f3a";
            this.bbiDelete.Enabled = false;
            this.bbiDelete.Id = 0x16;
            this.bbiDelete.ImageIndex = 13;
            this.bbiDelete.Name = "bbiDelete";
            this.bbiDelete.ItemClick += new ItemClickEventHandler(this.bbiDelete_ItemClick);
            this.bbiEdit.Caption = "Sửa";
            this.bbiEdit.Enabled = false;
            this.bbiEdit.Id = 0x17;
            this.bbiEdit.ImageIndex = 14;
            this.bbiEdit.Name = "bbiEdit";
            this.bbiEdit.ItemClick += new ItemClickEventHandler(this.bbiEdit_ItemClick);
            this.bbeMonth.Caption = "Th\x00e1ng:";
            this.bbeMonth.Edit = this.repMonth;
            this.bbeMonth.Id = 13;
            this.bbeMonth.Name = "bbeMonth";
            this.repMonth.Appearance.Font = new Font("Tahoma", 8.25f, FontStyle.Bold);
            this.repMonth.Appearance.Options.UseFont = true;
            this.repMonth.AutoHeight = false;
            this.repMonth.Buttons.AddRange(new EditorButton[] { new EditorButton() });
            this.repMonth.Mask.EditMask = "MM";
            this.repMonth.Name = "repMonth";
            this.bbeYear.Caption = "Năm:";
            this.bbeYear.Edit = this.repYear;
            this.bbeYear.Id = 14;
            this.bbeYear.Name = "bbeYear";
            this.repYear.Appearance.Font = new Font("Tahoma", 8.25f, FontStyle.Bold);
            this.repYear.Appearance.Options.UseFont = true;
            this.repYear.AutoHeight = false;
            this.repYear.Buttons.AddRange(new EditorButton[] { new EditorButton() });
            this.repYear.Mask.EditMask = "yyyy";
            this.repYear.Name = "repYear";
            this.bbeSalaryName.Caption = "T\x00ean Bảng Lương:";
            this.bbeSalaryName.Edit = this.repositoryItemComboBox1;
            this.bbeSalaryName.Id = 0x10;
            this.bbeSalaryName.Name = "bbeSalaryName";
            this.bbeSalaryName.Width = 130;
            this.repositoryItemComboBox1.Appearance.Font = new Font("Tahoma", 8.25f, FontStyle.Bold);
            this.repositoryItemComboBox1.Appearance.Options.UseFont = true;
            this.repositoryItemComboBox1.AutoHeight = false;
            this.repositoryItemComboBox1.Buttons.AddRange(new EditorButton[] { new EditorButton(ButtonPredefines.Combo, "", -1, true, false, false, ImageLocation.MiddleCenter, null, new KeyShortcut(Keys.None), appearance, "", null, null, true) });
            this.repositoryItemComboBox1.Name = "repositoryItemComboBox1";
            this.repositoryItemComboBox1.ReadOnly = true;
            this.bbiAdd.Caption = "Tạo";
            this.bbiAdd.Id = 4;
            this.bbiAdd.ImageIndex = 6;
            this.bbiAdd.Name = "bbiAdd";
            this.bbiAdd.ItemClick += new ItemClickEventHandler(this.bbiAdd_ItemClick);
            this.bbiCreate.Caption = "Ph\x00e1t Sinh";
            this.bbiCreate.Id = 20;
            this.bbiCreate.ImageIndex = 0x41;
            this.bbiCreate.Name = "bbiCreate";
            this.bbiCreate.ItemClick += new ItemClickEventHandler(this.bbiCreate_ItemClick);
            this.bbiPrint.Caption = "In";
            this.bbiPrint.Id = 5;
            this.bbiPrint.ImageIndex = 9;
            this.bbiPrint.Name = "bbiPrint";
            this.bbiPrint.ItemClick += new ItemClickEventHandler(this.bbiPrint_ItemClick);
            this.bbiExport.Caption = "Xuất";
            this.bbiExport.Id = 0x11;
            this.bbiExport.ImageIndex = 0x31;
            this.bbiExport.Name = "bbiExport";
            this.bbiExport.ItemClick += new ItemClickEventHandler(this.bbiExport_ItemClick);
            this.bbiLock.Caption = "Kh\x00f3a Sổ";
            this.bbiLock.Id = 9;
            this.bbiLock.ImageIndex = 12;
            this.bbiLock.Name = "bbiLock";
            this.bbiLock.ItemClick += new ItemClickEventHandler(this.bbiLock_ItemClick);
            this.bbiOpen.Caption = "Mở Sổ";
            this.bbiOpen.Id = 0x12;
            this.bbiOpen.ImageIndex = 0x21;
            this.bbiOpen.Name = "bbiOpen";
            this.bbiOpen.ItemClick += new ItemClickEventHandler(this.bbiOpen_ItemClick);
            this.bbiFinish.Caption = "Ho\x00e0n Th\x00e0nh";
            this.bbiFinish.Id = 11;
            this.bbiFinish.ImageIndex = 0x1f;
            this.bbiFinish.Name = "bbiFinish";
            this.bbiFinish.ItemClick += new ItemClickEventHandler(this.bbiFinish_ItemClick);
            this.bbiReload.Caption = "Nạp Lại";
            this.bbiReload.Id = 8;
            this.bbiReload.ImageIndex = 0x2a;
            this.bbiReload.Name = "bbiReload";
            this.bbiReload.ItemClick += new ItemClickEventHandler(this.bbiReload_ItemClick);
            this.bbiClose.Caption = "Đ\x00f3ng";
            this.bbiClose.Id = 12;
            this.bbiClose.ImageIndex = 0x16;
            this.bbiClose.Name = "bbiClose";
            this.bbiClose.ItemClick += new ItemClickEventHandler(this.bbiClose_ItemClick);
            this.dockManager1.AutoHideContainers.AddRange(new AutoHideContainer[] { this.hideContainerLeft });
            this.dockManager1.Form = this;
            this.dockManager1.TopZIndexControls.AddRange(new string[] { "DevExpress.XtraBars.BarDockControl", "DevExpress.XtraBars.StandaloneBarDockControl", "System.Windows.Forms.StatusBar", "DevExpress.XtraBars.Ribbon.RibbonStatusBar", "DevExpress.XtraBars.Ribbon.RibbonControl" });
            this.hideContainerLeft.Controls.Add(this.dockPanel1);
            this.hideContainerLeft.Dock = DockStyle.Left;
            this.hideContainerLeft.Location = new Point(0, 0x1a);
            this.hideContainerLeft.Name = "hideContainerLeft";
            this.hideContainerLeft.Size = new Size(0x13, 0x261);
            this.dockPanel1.Controls.Add(this.dockPanel1_Container);
            this.dockPanel1.Dock = DockingStyle.Left;
            this.dockPanel1.ID = new Guid("3d13ddb1-9f4f-497f-aa1b-5f5b4563a796");
            this.dockPanel1.Location = new Point(0, 0);
            this.dockPanel1.Name = "dockPanel1";
            this.dockPanel1.OriginalSize = new Size(280, 200);
            this.dockPanel1.SavedDock = DockingStyle.Left;
            this.dockPanel1.SavedIndex = 1;
            this.dockPanel1.Size = new Size(280, 0x261);
            this.dockPanel1.Text = "Ph\x00f2ng Ban V\x00e0 Tổ Nh\x00f3m";
            this.dockPanel1.Visibility = DockVisibility.AutoHide;
            this.dockPanel1_Container.Controls.Add(this.xucOrganization1);
            this.dockPanel1_Container.Location = new Point(3, 0x1d);
            this.dockPanel1_Container.Name = "dockPanel1_Container";
            this.dockPanel1_Container.Size = new Size(0x112, 0x241);
            this.dockPanel1_Container.TabIndex = 0;
            this.xucOrganization1.Dock = DockStyle.Fill;
            this.xucOrganization1.IsClose = CloseOrNew.None;
            this.xucOrganization1.Location = new Point(0, 0);
            this.xucOrganization1.Name = "xucOrganization1";
            this.xucOrganization1.NotSave = false;
            command.Caption = "";
            command.Enable = false;
            command.Visibility = BarItemVisibility.Never;
            button.Add = command;
            command2.Caption = "";
            command2.Enable = false;
            command2.Visibility = BarItemVisibility.Never;
            button.Cancel = command2;
            command3.Caption = "";
            command3.Enable = false;
            command3.Visibility = BarItemVisibility.Never;
            button.Change = command3;
            command4.Caption = "";
            command4.Enable = false;
            command4.Visibility = BarItemVisibility.Never;
            button.Close = command4;
            command5.Caption = "";
            command5.Enable = false;
            command5.Visibility = BarItemVisibility.Never;
            button.Custom = command5;
            command6.Caption = "";
            command6.Enable = false;
            command6.Visibility = BarItemVisibility.Never;
            button.Delete = command6;
            command7.Caption = "";
            command7.Enable = false;
            command7.Visibility = BarItemVisibility.Never;
            button.Export = command7;
            command8.Caption = "";
            command8.Enable = false;
            command8.Visibility = BarItemVisibility.Never;
            button.Filter = command8;
            command9.Caption = "";
            command9.Enable = false;
            command9.Visibility = BarItemVisibility.Never;
            button.FilterCustomer = command9;
            command10.Caption = "";
            command10.Enable = false;
            command10.Visibility = BarItemVisibility.Never;
            button.FilterStock = command10;
            command11.Caption = "";
            command11.Enable = false;
            command11.Visibility = BarItemVisibility.Never;
            button.Find = command11;
            button.GClose = false;
            button.GCommand = false;
            button.GExport = false;
            command12.Caption = "";
            command12.Enable = false;
            command12.Visibility = BarItemVisibility.Never;
            button.Go = command12;
            button.GOption = false;
            button.GPrint = false;
            button.GRecords = false;
            button.GSearchBar = false;
            button.GSettings = false;
            button.GVaildation = false;
            command13.Caption = "";
            command13.Enable = false;
            command13.Visibility = BarItemVisibility.Never;
            button.Import = command13;
            command14.Caption = "";
            command14.Enable = false;
            command14.Visibility = BarItemVisibility.Never;
            button.Next = command14;
            command15.Caption = "";
            command15.Enable = false;
            command15.Visibility = BarItemVisibility.Never;
            button.PageSetup = command15;
            button.PHome = false;
            command16.Caption = "";
            command16.Enable = false;
            command16.Visibility = BarItemVisibility.Never;
            button.Previous = command16;
            command17.Caption = "";
            command17.Enable = false;
            command17.Visibility = BarItemVisibility.Never;
            button.Print = command17;
            command18.Caption = "";
            command18.Enable = false;
            command18.Visibility = BarItemVisibility.Never;
            button.PrintPreview = command18;
            button.PTool = false;
            command19.Caption = "";
            command19.Enable = false;
            command19.Visibility = BarItemVisibility.Never;
            button.Redo = command19;
            command20.Caption = "";
            command20.Enable = false;
            command20.Visibility = BarItemVisibility.Never;
            button.Refresh = command20;
            command21.Caption = "";
            command21.Enable = false;
            command21.Visibility = BarItemVisibility.Never;
            button.Save = command21;
            command22.Caption = "";
            command22.Enable = false;
            command22.Visibility = BarItemVisibility.Never;
            button.SaveAndClose = command22;
            command23.Caption = "";
            command23.Enable = false;
            command23.Visibility = BarItemVisibility.Never;
            button.SaveAndNew = command23;
            command24.Caption = "";
            command24.Enable = false;
            command24.Visibility = BarItemVisibility.Never;
            button.Search = command24;
            command25.Caption = "";
            command25.Enable = false;
            command25.Visibility = BarItemVisibility.Never;
            button.SearchText = command25;
            command26.Caption = "";
            command26.Enable = false;
            command26.Visibility = BarItemVisibility.Never;
            button.Task = command26;
            command27.Caption = "";
            command27.Enable = false;
            command27.Visibility = BarItemVisibility.Never;
            button.Undo = command27;
            command28.Caption = "";
            command28.Enable = false;
            command28.Visibility = BarItemVisibility.Never;
            button.Vaildate = command28;
            command29.Caption = "";
            command29.Enable = false;
            command29.Visibility = BarItemVisibility.Never;
            button.View = command29;
            this.xucOrganization1.RibbonBar = button;
            this.xucOrganization1.Size = new Size(0x112, 0x241);
            this.xucOrganization1.Status = Actions.None;
            this.xucOrganization1.TabIndex = 0;
            this.xucOrganization1.Title = "";
            this.imageCollection2.ImageStream = (ImageCollectionStreamer) manager.GetObject("imageCollection2.ImageStream");
            this.imageCollection2.Images.SetKeyName(0x3d, "Vista (35).ico");
            this.imageCollection2.Images.SetKeyName(0x3e, "Security.ico");
            this.imageCollection2.Images.SetKeyName(0x3f, "RibbonPrintPreview_DocumentMapLarge.png");
            this.imageCollection2.Images.SetKeyName(0x40, "11.png");
            this.imageCollection2.Images.SetKeyName(0x41, "Sua.png");
            this.imageCollection2.Images.SetKeyName(0x42, "Them.png");
            this.imageCollection2.Images.SetKeyName(0x43, "PhanQuyen.png");
            this.imageCollection2.Images.SetKeyName(0x44, "11.png");
            this.imageCollection2.Images.SetKeyName(0x45, "plus.png");
            this.imageCollection2.Images.SetKeyName(70, "send.png");
            this.bbiFormula.Caption = "Thiết Lập C\x00f4ng Thức";
            this.bbiFormula.Id = 10;
            this.bbiFormula.ImageIndex = 0;
            this.bbiFormula.Name = "bbiFormula";
            this.gcList.Dock = DockStyle.Fill;
            this.gcList.EmbeddedNavigator.Buttons.Append.Visible = false;
            this.gcList.EmbeddedNavigator.Buttons.CancelEdit.Visible = false;
            this.gcList.EmbeddedNavigator.Buttons.Edit.Visible = false;
            this.gcList.EmbeddedNavigator.Buttons.EndEdit.Visible = false;
            this.gcList.EmbeddedNavigator.Buttons.Remove.Visible = false;
            this.gcList.EmbeddedNavigator.TextStringFormat = "{0}/{1}";
            this.gcList.Location = new Point(0x13, 70);
            this.gcList.MainView = this.gbList;
            this.gcList.Name = "gcList";
            this.gcList.RepositoryItems.AddRange(new RepositoryItem[] { this.repCalculator });
            this.gcList.Size = new Size(0x41e, 0x235);
            this.gcList.TabIndex = 5;
            this.gcList.UseEmbeddedNavigator = true;
            this.gcList.ViewCollection.AddRange(new BaseView[] { this.gbList });
            this.gbList.Appearance.GroupRow.Font = new Font("Tahoma", 8.25f, FontStyle.Bold);
            this.gbList.Appearance.GroupRow.Options.UseFont = true;
            this.gbList.Appearance.HeaderPanel.Options.UseTextOptions = true;
            this.gbList.Appearance.HeaderPanel.TextOptions.HAlignment = HorzAlignment.Center;
            this.gbList.Appearance.HeaderPanel.TextOptions.WordWrap = WordWrap.Wrap;
            this.gbList.ColumnPanelRowHeight = 0x20;
            this.gbList.Columns.AddRange(new GridColumn[] { this.colSalaryPayID, this.colEmployeeCode, this.colFirstName, this.colLastName, this.colBranchName, this.colDepartmentName, this.colGroupName, this.colOrder, this.colDate, this.colReason, this.colMoney, this.colPayMoney, this.colRealMoney, this.colPerson, this.colDescription });
            this.gbList.FixedLineWidth = 1;
            this.gbList.FocusRectStyle = DrawFocusRectStyle.RowFocus;
            this.gbList.GridControl = this.gcList;
            this.gbList.GroupPanelText = "K\x00e9o v\x00e0 Thả cột v\x00e0o đ\x00e2y để nh\x00f3m dữ liệu";
            this.gbList.GroupSummary.AddRange(new GridSummaryItem[] { new GridGroupSummaryItem(SummaryItemType.Sum, "RealMoney", null, " - Tổng số tiền: {0:##,##0}"), new GridGroupSummaryItem(SummaryItemType.Sum, "Money", this.colMoney, "{0:##,##0}"), new GridGroupSummaryItem(SummaryItemType.Sum, "PayMoney", this.colPayMoney, "{0:##,##0}"), new GridGroupSummaryItem(SummaryItemType.Sum, "RealMoney", this.colRealMoney, "{0:##,##0}") });
            this.gbList.IndicatorWidth = 40;
            this.gbList.Name = "gbList";
            this.gbList.OptionsBehavior.AllowIncrementalSearch = true;
            this.gbList.OptionsBehavior.AutoExpandAllGroups = true;
            this.gbList.OptionsBehavior.CopyToClipboardWithColumnHeaders = false;
            this.gbList.OptionsBehavior.FocusLeaveOnTab = true;
            this.gbList.OptionsCustomization.AllowFilter = false;
            this.gbList.OptionsFilter.AllowColumnMRUFilterList = false;
            this.gbList.OptionsFilter.AllowFilterEditor = false;
            this.gbList.OptionsFilter.AllowMRUFilterList = false;
            this.gbList.OptionsLayout.StoreAllOptions = true;
            this.gbList.OptionsLayout.StoreAppearance = true;
            this.gbList.OptionsMenu.EnableColumnMenu = false;
            this.gbList.OptionsMenu.EnableGroupPanelMenu = false;
            this.gbList.OptionsNavigation.EnterMoveNextColumn = true;
            this.gbList.OptionsPrint.AutoWidth = false;
            this.gbList.OptionsPrint.ExpandAllDetails = true;
            this.gbList.OptionsPrint.PrintPreview = true;
            this.gbList.OptionsSelection.InvertSelection = true;
            this.gbList.OptionsSelection.MultiSelect = true;
            this.gbList.OptionsView.ColumnAutoWidth = false;
            this.gbList.OptionsView.EnableAppearanceEvenRow = true;
            this.gbList.OptionsView.ShowAutoFilterRow = true;
            this.gbList.OptionsView.ShowFooter = true;
            this.gbList.OptionsView.ShowGroupPanel = false;
            this.gbList.FocusedRowChanged += new FocusedRowChangedEventHandler(this.gbList_FocusedRowChanged);
            this.gbList.CustomDrawRowIndicator += new RowIndicatorCustomDrawEventHandler(this.gbList_CustomDrawRowIndicator);
            this.gbList.KeyDown += new KeyEventHandler(this.gbList_KeyDown);
            this.gbList.MouseDown += new MouseEventHandler(this.gbList_MouseDown);
            this.gbList.DoubleClick += new EventHandler(this.gbList_DoubleClick);
            this.colSalaryPayID.Caption = "M\x00e3 thanh to\x00e1n";
            this.colSalaryPayID.FieldName = "SalaryPayID";
            this.colSalaryPayID.Name = "colSalaryPayID";
            this.colSalaryPayID.OptionsColumn.ReadOnly = true;
            this.colEmployeeCode.AppearanceHeader.Font = new Font("Tahoma", 8.25f, FontStyle.Bold);
            this.colEmployeeCode.AppearanceHeader.Options.UseFont = true;
            this.colEmployeeCode.Caption = "M\x00e3 NV";
            this.colEmployeeCode.FieldName = "EmployeeCode";
            this.colEmployeeCode.Name = "colEmployeeCode";
            this.colEmployeeCode.OptionsColumn.AllowEdit = false;
            this.colEmployeeCode.OptionsColumn.ReadOnly = true;
            this.colEmployeeCode.Visible = true;
            this.colEmployeeCode.VisibleIndex = 0;
            this.colEmployeeCode.Width = 0x43;
            this.colFirstName.AppearanceHeader.Font = new Font("Tahoma", 8.25f, FontStyle.Bold);
            this.colFirstName.AppearanceHeader.Options.UseFont = true;
            this.colFirstName.Caption = "Họ l\x00f3t";
            this.colFirstName.FieldName = "FirstName";
            this.colFirstName.Name = "colFirstName";
            this.colFirstName.OptionsColumn.AllowEdit = false;
            this.colFirstName.OptionsColumn.ReadOnly = true;
            this.colFirstName.Visible = true;
            this.colFirstName.VisibleIndex = 1;
            this.colFirstName.Width = 0x60;
            this.colLastName.AppearanceHeader.Font = new Font("Tahoma", 8.25f, FontStyle.Bold);
            this.colLastName.AppearanceHeader.Options.UseFont = true;
            this.colLastName.Caption = "T\x00ean";
            this.colLastName.FieldName = "LastName";
            this.colLastName.Name = "colLastName";
            this.colLastName.OptionsColumn.AllowEdit = false;
            this.colLastName.OptionsColumn.ReadOnly = true;
            this.colLastName.Visible = true;
            this.colLastName.VisibleIndex = 2;
            this.colLastName.Width = 0x3a;
            this.colBranchName.Caption = "Chi nh\x00e1nh";
            this.colBranchName.FieldName = "BranchName";
            this.colBranchName.Name = "colBranchName";
            this.colBranchName.OptionsColumn.AllowEdit = false;
            this.colBranchName.OptionsColumn.AllowMerge = DefaultBoolean.False;
            this.colBranchName.OptionsColumn.ReadOnly = true;
            this.colDepartmentName.Caption = "Ph\x00f2ng ban";
            this.colDepartmentName.FieldName = "DepartmentName";
            this.colDepartmentName.Name = "colDepartmentName";
            this.colDepartmentName.OptionsColumn.AllowEdit = false;
            this.colDepartmentName.OptionsColumn.AllowMerge = DefaultBoolean.False;
            this.colDepartmentName.OptionsColumn.ReadOnly = true;
            this.colGroupName.Caption = "Tổ nh\x00f3m";
            this.colGroupName.FieldName = "GroupName";
            this.colGroupName.Name = "colGroupName";
            this.colGroupName.OptionsColumn.AllowEdit = false;
            this.colGroupName.OptionsColumn.AllowMerge = DefaultBoolean.False;
            this.colGroupName.OptionsColumn.ReadOnly = true;
            this.colOrder.AppearanceCell.Options.UseTextOptions = true;
            this.colOrder.AppearanceCell.TextOptions.HAlignment = HorzAlignment.Center;
            this.colOrder.Caption = "Lần thanh to\x00e1n";
            this.colOrder.FieldName = "Order";
            this.colOrder.Name = "colOrder";
            this.colOrder.OptionsColumn.AllowEdit = false;
            this.colOrder.OptionsColumn.ReadOnly = true;
            this.colOrder.Visible = true;
            this.colOrder.VisibleIndex = 3;
            this.colOrder.Width = 0x63;
            this.colDate.AppearanceHeader.ForeColor = Color.DarkGreen;
            this.colDate.AppearanceHeader.Options.UseForeColor = true;
            this.colDate.Caption = "Ng\x00e0y thanh to\x00e1n";
            this.colDate.FieldName = "Date";
            this.colDate.Name = "colDate";
            this.colDate.OptionsColumn.AllowEdit = false;
            this.colDate.OptionsColumn.ReadOnly = true;
            this.colDate.Visible = true;
            this.colDate.VisibleIndex = 4;
            this.colDate.Width = 0x6c;
            this.colReason.AppearanceHeader.ForeColor = Color.DarkGreen;
            this.colReason.AppearanceHeader.Options.UseForeColor = true;
            this.colReason.Caption = "L\x00fd do thanh to\x00e1n";
            this.colReason.FieldName = "Reason";
            this.colReason.Name = "colReason";
            this.colReason.OptionsColumn.AllowEdit = false;
            this.colReason.OptionsColumn.ReadOnly = true;
            this.colReason.Width = 140;
            this.colMoney.AppearanceHeader.ForeColor = Color.Peru;
            this.colMoney.AppearanceHeader.Options.UseForeColor = true;
            this.colMoney.Caption = "Số tiền";
            this.colMoney.ColumnEdit = this.repCalculator;
            this.colMoney.FieldName = "Money";
            this.colMoney.Name = "colMoney";
            this.colMoney.OptionsColumn.AllowEdit = false;
            this.colMoney.OptionsColumn.ReadOnly = true;
            this.colMoney.SummaryItem.DisplayFormat = "{0:##,##0}";
            this.colMoney.SummaryItem.SummaryType = SummaryItemType.Sum;
            this.colMoney.Visible = true;
            this.colMoney.VisibleIndex = 5;
            this.repCalculator.AutoHeight = false;
            this.repCalculator.Buttons.AddRange(new EditorButton[] { new EditorButton(ButtonPredefines.Combo) });
            this.repCalculator.DisplayFormat.FormatString = "\"{0:##,##0}\"";
            this.repCalculator.EditFormat.FormatString = "\"{0:##,##0}\"";
            this.repCalculator.Mask.UseMaskAsDisplayFormat = true;
            this.repCalculator.Name = "repCalculator";
            this.colPayMoney.AppearanceHeader.ForeColor = Color.Peru;
            this.colPayMoney.AppearanceHeader.Options.UseForeColor = true;
            this.colPayMoney.Caption = "Nộp lại";
            this.colPayMoney.ColumnEdit = this.repCalculator;
            this.colPayMoney.FieldName = "PayMoney";
            this.colPayMoney.Name = "colPayMoney";
            this.colPayMoney.OptionsColumn.AllowEdit = false;
            this.colPayMoney.OptionsColumn.ReadOnly = true;
            this.colPayMoney.SummaryItem.DisplayFormat = "{0:##,##0}";
            this.colPayMoney.SummaryItem.SummaryType = SummaryItemType.Sum;
            this.colPayMoney.Visible = true;
            this.colPayMoney.VisibleIndex = 6;
            this.colRealMoney.AppearanceHeader.ForeColor = Color.Peru;
            this.colRealMoney.AppearanceHeader.Options.UseForeColor = true;
            this.colRealMoney.Caption = "Thực thanh to\x00e1n";
            this.colRealMoney.ColumnEdit = this.repCalculator;
            this.colRealMoney.FieldName = "RealMoney";
            this.colRealMoney.Name = "colRealMoney";
            this.colRealMoney.OptionsColumn.AllowEdit = false;
            this.colRealMoney.OptionsColumn.ReadOnly = true;
            this.colRealMoney.SummaryItem.DisplayFormat = "{0:##,##0}";
            this.colRealMoney.SummaryItem.SummaryType = SummaryItemType.Sum;
            this.colRealMoney.Visible = true;
            this.colRealMoney.VisibleIndex = 7;
            this.colRealMoney.Width = 0x66;
            this.colPerson.Caption = "Người thanh to\x00e1n";
            this.colPerson.FieldName = "Person";
            this.colPerson.Name = "colPerson";
            this.colPerson.OptionsColumn.AllowEdit = false;
            this.colPerson.OptionsColumn.ReadOnly = true;
            this.colPerson.Visible = true;
            this.colPerson.VisibleIndex = 8;
            this.colPerson.Width = 0x7b;
            this.colDescription.Caption = "Ghi ch\x00fa";
            this.colDescription.FieldName = "Description";
            this.colDescription.Name = "colDescription";
            this.colDescription.OptionsColumn.AllowEdit = false;
            this.colDescription.OptionsColumn.ReadOnly = true;
            this.colDescription.Visible = true;
            this.colDescription.VisibleIndex = 9;
            this.colDescription.Width = 0x120;
            this.panelControl1.BorderStyle = BorderStyles.NoBorder;
            this.panelControl1.Controls.Add(this.flowLayoutPanel3);
            this.panelControl1.Controls.Add(this.flowLayoutPanel2);
            this.panelControl1.Controls.Add(this.flowLayoutPanel1);
            this.panelControl1.Controls.Add(this.lbMessage);
            this.panelControl1.Dock = DockStyle.Top;
            this.panelControl1.Location = new Point(0x13, 0x1a);
            this.panelControl1.Name = "panelControl1";
            this.panelControl1.Size = new Size(0x41e, 0x2c);
            this.panelControl1.TabIndex = 9;
            this.flowLayoutPanel3.Anchor = AnchorStyles.Right | AnchorStyles.Top;
            this.flowLayoutPanel3.Controls.Add(this.xucExpandCollapseButton1);
            this.flowLayoutPanel3.Controls.Add(this.lbGroupName);
            this.flowLayoutPanel3.Controls.Add(this.lbDepartmentName);
            this.flowLayoutPanel3.FlowDirection = FlowDirection.RightToLeft;
            this.flowLayoutPanel3.Location = new Point(0x264, 0x16);
            this.flowLayoutPanel3.Name = "flowLayoutPanel3";
            this.flowLayoutPanel3.Size = new Size(0x1b7, 0x15);
            this.flowLayoutPanel3.TabIndex = 8;
            this.xucExpandCollapseButton1.Location = new Point(0x1a3, 3);
            this.xucExpandCollapseButton1.Name = "xucExpandCollapseButton1";
            this.xucExpandCollapseButton1.Size = new Size(0x11, 15);
            this.xucExpandCollapseButton1.TabIndex = 5;
            this.xucExpandCollapseButton1.ExpandCollapsed += new xucExpandCollapseButton.ExpandCollapsedHander(this.xucExpandCollapseButton1_ExpandCollapsed);
            this.lbGroupName.Anchor = AnchorStyles.Right | AnchorStyles.Top;
            this.lbGroupName.Location = new Point(0x15b, 3);
            this.lbGroupName.Name = "lbGroupName";
            this.lbGroupName.Size = new Size(0x42, 13);
            this.lbGroupName.TabIndex = 4;
            this.lbGroupName.Text = " - GroupName";
            this.lbDepartmentName.Anchor = AnchorStyles.Right | AnchorStyles.Top;
            this.lbDepartmentName.Location = new Point(0x101, 3);
            this.lbDepartmentName.Name = "lbDepartmentName";
            this.lbDepartmentName.Size = new Size(0x54, 13);
            this.lbDepartmentName.TabIndex = 3;
            this.lbDepartmentName.Text = "DepartmentName";
            this.flowLayoutPanel2.Anchor = AnchorStyles.Right | AnchorStyles.Top;
            this.flowLayoutPanel2.Controls.Add(this.lbBranchName);
            this.flowLayoutPanel2.Controls.Add(this.lbCompanyName);
            this.flowLayoutPanel2.FlowDirection = FlowDirection.RightToLeft;
            this.flowLayoutPanel2.Location = new Point(0x264, 1);
            this.flowLayoutPanel2.Name = "flowLayoutPanel2";
            this.flowLayoutPanel2.Size = new Size(0x1b7, 0x12);
            this.flowLayoutPanel2.TabIndex = 7;
            this.lbBranchName.Anchor = AnchorStyles.Right | AnchorStyles.Top;
            this.lbBranchName.Appearance.Font = new Font("Tahoma", 9f, FontStyle.Bold);
            this.lbBranchName.Appearance.Options.UseFont = true;
            this.lbBranchName.Location = new Point(0x15c, 3);
            this.lbBranchName.Name = "lbBranchName";
            this.lbBranchName.Size = new Size(0x58, 14);
            this.lbBranchName.TabIndex = 2;
            this.lbBranchName.Text = " - BranchName";
            this.lbCompanyName.Anchor = AnchorStyles.Right | AnchorStyles.Top;
            this.lbCompanyName.Appearance.Font = new Font("Tahoma", 9f, FontStyle.Bold);
            this.lbCompanyName.Appearance.Options.UseFont = true;
            this.lbCompanyName.Location = new Point(0xfc, 3);
            this.lbCompanyName.Name = "lbCompanyName";
            this.lbCompanyName.Size = new Size(90, 14);
            this.lbCompanyName.TabIndex = 1;
            this.lbCompanyName.Text = "CompanyName";
            this.flowLayoutPanel1.Controls.Add(this.lbSalaryName);
            this.flowLayoutPanel1.Controls.Add(this.lbMessage1);
            this.flowLayoutPanel1.Controls.Add(this.ptLock);
            this.flowLayoutPanel1.Controls.Add(this.ptFinish);
            this.flowLayoutPanel1.Location = new Point(3, 4);
            this.flowLayoutPanel1.Name = "flowLayoutPanel1";
            this.flowLayoutPanel1.Size = new Size(0x25b, 20);
            this.flowLayoutPanel1.TabIndex = 4;
            this.lbSalaryName.Appearance.Font = new Font("Tahoma", 9f, FontStyle.Bold);
            this.lbSalaryName.Appearance.Options.UseFont = true;
            this.lbSalaryName.Location = new Point(3, 3);
            this.lbSalaryName.Name = "lbSalaryName";
            this.lbSalaryName.Size = new Size(0xdf, 14);
            this.lbSalaryName.TabIndex = 0;
            this.lbSalaryName.Text = "Bảng Thanh To\x00e1n Lương Th\x00e1ng [00]";
            this.lbMessage1.Appearance.Font = new Font("Tahoma", 9f);
            this.lbMessage1.Appearance.ForeColor = Color.Red;
            this.lbMessage1.Appearance.Options.UseFont = true;
            this.lbMessage1.Appearance.Options.UseForeColor = true;
            this.lbMessage1.Location = new Point(0xe8, 3);
            this.lbMessage1.Name = "lbMessage1";
            this.lbMessage1.Padding = new Padding(4, 0, 0, 0);
            this.lbMessage1.Size = new Size(0x14b, 14);
            this.lbMessage1.TabIndex = 1;
            this.lbMessage1.Text = ">> Nhấn n\x00fat \"Tạo\" để khởi tạo bảng lương cho th\x00e1ng n\x00e0y!";
            this.lbMessage1.Visible = false;
            this.ptLock.Image = MsgResc.lock_open__1_;
            this.ptLock.Location = new Point(570, 0);
            this.ptLock.Margin = new Padding(4, 0, 0, 0);
            this.ptLock.Name = "ptLock";
            this.ptLock.Size = new Size(0x10, 0x10);
            this.ptLock.TabIndex = 10;
            this.ptLock.TabStop = false;
            this.ptLock.Visible = false;
            this.ptFinish.Image = MsgResc.check;
            this.ptFinish.Location = new Point(4, 20);
            this.ptFinish.Margin = new Padding(4, 0, 0, 0);
            this.ptFinish.Name = "ptFinish";
            this.ptFinish.Size = new Size(0x10, 0x10);
            this.ptFinish.TabIndex = 11;
            this.ptFinish.TabStop = false;
            this.ptFinish.Visible = false;
            this.lbMessage.Appearance.ForeColor = Color.DarkBlue;
            this.lbMessage.Appearance.Options.UseForeColor = true;
            this.lbMessage.Location = new Point(4, 0x1a);
            this.lbMessage.Name = "lbMessage";
            this.lbMessage.Size = new Size(0x19f, 13);
            this.lbMessage.TabIndex = 2;
            this.lbMessage.Text = "[Nếu bạn chưa ph\x00e1t sinh dữ liệu chấm c\x00f4ng của th\x00e1ng n\x00e0y th\x00ec vui l\x00f2ng thực hiện trước]";
            this.gridColumn1.Caption = "gridColumn1";
            this.gridColumn1.Name = "gridColumn1";
            this.gridColumn1.Visible = true;
            this.gridColumn1.VisibleIndex = 0;
            this.gridColumn2.Caption = "gridColumn2";
            this.gridColumn2.Name = "gridColumn2";
            this.gridColumn2.Visible = true;
            this.gridColumn2.VisibleIndex = 1;
            base.AutoScaleDimensions = new SizeF(6f, 13f);
            base.AutoScaleMode = AutoScaleMode.Font;
            base.Controls.Add(this.gcList);
            base.Controls.Add(this.panelControl1);
            base.Controls.Add(this.hideContainerLeft);
            base.Controls.Add(this.barDockControlLeft);
            base.Controls.Add(this.barDockControlRight);
            base.Controls.Add(this.barDockControlBottom);
            base.Controls.Add(this.barDockControlTop);
            base.Name = "xucSalaryPay";
            base.Size = new Size(0x431, 0x27b);
            this.barManager1.EndInit();
            this.repMonth.EndInit();
            this.repYear.EndInit();
            this.repositoryItemComboBox1.EndInit();
            this.dockManager1.EndInit();
            this.hideContainerLeft.ResumeLayout(false);
            this.dockPanel1.ResumeLayout(false);
            this.dockPanel1_Container.ResumeLayout(false);
            this.imageCollection2.EndInit();
            this.gcList.EndInit();
            this.gbList.EndInit();
            this.repCalculator.EndInit();
            this.panelControl1.EndInit();
            this.panelControl1.ResumeLayout(false);
            this.panelControl1.PerformLayout();
            this.flowLayoutPanel3.ResumeLayout(false);
            this.flowLayoutPanel3.PerformLayout();
            this.flowLayoutPanel2.ResumeLayout(false);
            this.flowLayoutPanel2.PerformLayout();
            this.flowLayoutPanel1.ResumeLayout(false);
            this.flowLayoutPanel1.PerformLayout();
            ((ISupportInitialize) this.ptLock).EndInit();
            ((ISupportInitialize) this.ptFinish).EndInit();
            base.ResumeLayout(false);
        }

        private void InitInterface()
        {
            if (!(this.m_IsLock || this.m_IsFinish))
            {
                this.bbiLock.Enabled = true;
                this.ptLock.Visible = false;
                this.bbiOpen.Enabled = true;
                this.bbiFinish.Enabled = true;
                this.ptFinish.Visible = false;
                this.bbiAdd1.Enabled = true;
                this.bbiEdit.Enabled = true;
                this.bbiDelete.Enabled = true;
                this.bbiCreate.Enabled = true;
                this.lbMessage.Text = "Đ\x00e3 mở sổ - Được ph\x00e9p chỉnh sửa bảng t\x00ednh lương th\x00e1ng n\x00e0y";
            }
            else if (!(!this.m_IsLock || this.m_IsFinish))
            {
                this.bbiLock.Enabled = false;
                this.ptLock.Visible = true;
                this.bbiOpen.Enabled = true;
                this.bbiFinish.Enabled = true;
                this.ptFinish.Visible = false;
                this.bbiAdd1.Enabled = false;
                this.bbiEdit.Enabled = false;
                this.bbiDelete.Enabled = false;
                this.bbiCreate.Enabled = false;
                this.lbMessage.Text = "Đ\x00e3 kho\x00e1 sổ - Kh\x00f4ng được ph\x00e9p chỉnh sửa";
            }
            else if (!(this.m_IsLock || !this.m_IsFinish))
            {
                this.bbiLock.Enabled = true;
                this.ptLock.Visible = false;
                this.bbiOpen.Enabled = false;
                this.bbiFinish.Enabled = false;
                this.ptFinish.Visible = true;
                this.bbiAdd1.Enabled = false;
                this.bbiEdit.Enabled = false;
                this.bbiDelete.Enabled = false;
                this.bbiCreate.Enabled = false;
                this.lbMessage.Text = "Đ\x00e3 ho\x00e0n th\x00e0nh bảng t\x00ednh lương của th\x00e1ng n\x00e0y - Kh\x00f4ng được ph\x00e9p chỉnh sửa";
            }
            else if (this.m_IsLock && this.m_IsFinish)
            {
                this.bbiLock.Enabled = false;
                this.ptLock.Visible = true;
                this.bbiOpen.Enabled = false;
                this.bbiFinish.Enabled = false;
                this.ptFinish.Visible = true;
                this.bbiAdd1.Enabled = false;
                this.bbiEdit.Enabled = false;
                this.bbiDelete.Enabled = false;
                this.bbiCreate.Enabled = false;
                this.lbMessage.Text = "Đ\x00e3 ho\x00e0n th\x00e0nh bảng t\x00ednh lương của th\x00e1ng n\x00e0y - Kh\x00f4ng được ph\x00e9p chỉnh sửa";
            }
        }

        public void LoadGrid(int Level, string Code)
        {
            try
            {
                Guid salaryTableListID = this.m_SalaryTableListID;
                this.gcList.DataSource = new HRM_SALARY_PAY().GetList(Level, Code, salaryTableListID);
            }
            catch
            {
            }
        }

        private void LoadSalaryMonth()
        {
            this.bbeSalaryName.EditValue = "Th\x00e1ng " + this.m_Month.ToString() + " - " + this.m_Year.ToString();
            this.lbSalaryName.Text = "Bảng Thanh To\x00e1n Lương Th\x00e1ng " + this.m_Month.ToString() + " - " + this.m_Year.ToString();
            HRM_SALARY_TABLELIST hrm_salary_tablelist = new HRM_SALARY_TABLELIST();
            if (!hrm_salary_tablelist.Exist(this.m_Month, this.m_Year))
            {
                this.bbiAdd.Visibility = BarItemVisibility.Always;
                this.bbiCreate.Visibility = BarItemVisibility.Never;
                this.bbiLock.Enabled = false;
                this.bbiOpen.Enabled = false;
                this.bbiFinish.Enabled = false;
                this.bbiAdd1.Enabled = false;
                this.bbiEdit.Enabled = false;
                this.bbiDelete.Enabled = false;
                this.m_SalaryTableListID = Guid.Empty;
                this.gcList.DataSource = null;
                this.lbMessage1.Visible = true;
            }
            else
            {
                this.bbiAdd.Visibility = BarItemVisibility.Never;
                this.bbiCreate.Visibility = BarItemVisibility.Always;
                this.lbMessage1.Visible = false;
                hrm_salary_tablelist.Get(this.m_Month, this.m_Year);
                this.m_IsLock = hrm_salary_tablelist.IsLock;
                this.m_IsFinish = hrm_salary_tablelist.IsFinish;
                this.InitInterface();
                this.m_SalaryTableListID = hrm_salary_tablelist.SalaryTableListID;
                this.gcList.DataSource = new HRM_SALARY_PAY().GetList(this.m_Level, this.m_Code, this.m_SalaryTableListID);
            }
        }

        private void RaiseClosedHander()
        {
            if (this.Closed != null)
            {
                this.Closed(this);
            }
        }

        private void RaiseSalaryPayChangedHander()
        {
            if (this.SalaryPayChanged != null)
            {
                this.SalaryPayChanged(this);
            }
        }

        private void Reload()
        {
            this.LoadSalaryMonth();
        }

        private void repMonth_EditValueChanged(object sender, EventArgs e)
        {
            this.LoadSalaryMonth();
        }

        private void repMonth_EditValueChanging(object sender, ChangingEventArgs e)
        {
            this.m_Month = Convert.ToDateTime(e.NewValue.ToString()).Month;
        }

        private void repYear_EditValueChanged(object sender, EventArgs e)
        {
            this.LoadSalaryMonth();
        }

        private void repYear_EditValueChanging(object sender, ChangingEventArgs e)
        {
            this.m_Year = Convert.ToDateTime(e.NewValue.ToString()).Year;
        }

        public void SetMonthYear(int Month, int Year)
        {
            this.m_Month = Month;
            this.m_Year = Year;
            this.bbeMonth.EditValue = new System.DateTime(this.m_Year, this.m_Month, 1);
            this.bbeYear.EditValue = new System.DateTime(this.m_Year, this.m_Month, 1);
            this.Init();
        }

        private void ucList_ListKeyDown(object sender, KeyEventArgs key)
        {
            if (key.KeyCode == Keys.F2)
            {
                if (this.gbList.RowCount != 0)
                {
                    this.Change();
                }
            }
            else if ((key.KeyCode == Keys.Control) | (key.KeyCode == Keys.E))
            {
                if (this.gbList.RowCount != 0)
                {
                    this.Change();
                }
            }
            else if (key.KeyCode == Keys.Enter)
            {
                if (this.gbList.RowCount != 0)
                {
                    this.Change();
                }
            }
            else if (key.KeyCode == Keys.F5)
            {
                this.Reload();
            }
            else if ((key.KeyCode == Keys.Control) | (key.KeyCode == Keys.N))
            {
                this.Add();
            }
            else if ((key.KeyCode == Keys.Control) | (key.KeyCode == Keys.T))
            {
                this.Add();
            }
        }

        private void UpdateRow(HRM_SALARY_PAY item)
        {
            GridView gbList = this.gbList;
            int focusedRowHandle = this.gbList.FocusedRowHandle;
            gbList.SetRowCellValue(focusedRowHandle, "EmployeeCode", item.EmployeeCode);
            HRM_EMPLOYEE hrm_employee = new HRM_EMPLOYEE();
            hrm_employee.Get(item.EmployeeCode);
            gbList.SetRowCellValue(focusedRowHandle, "FirstName", hrm_employee.FirstName);
            gbList.SetRowCellValue(focusedRowHandle, "LastName", hrm_employee.LastName);
            gbList.SetRowCellValue(focusedRowHandle, "Order", item.Order);
            gbList.SetRowCellValue(focusedRowHandle, "Reason", item.Reason);
            gbList.SetRowCellValue(focusedRowHandle, "Date", item.Date);
            gbList.SetRowCellValue(focusedRowHandle, "Money", item.Money);
            gbList.SetRowCellValue(focusedRowHandle, "PayMoney", item.PayMoney);
            gbList.SetRowCellValue(focusedRowHandle, "RealMoney", item.RealMoney);
            gbList.SetRowCellValue(focusedRowHandle, "Person", item.Person);
            gbList.SetRowCellValue(focusedRowHandle, "Description", item.Description);
            gbList.UpdateCurrentRow();
        }

        private void xfm_Created(object sender, int Order, System.DateTime Date, int PayType, double Value, string Person, string Description, bool IsSkip)
        {
            HRM_SALARY_PAY.Create(this.m_Level, this.m_Code, this.m_SalaryTableListID.ToString(), Order, Date, PayType, Value, Person, Description, IsSkip);
            this.LoadSalaryMonth();
            this.RaiseSalaryPayChangedHander();
        }

        private void xucExpandCollapseButton1_ExpandCollapsed(object sender, bool IsExpand)
        {
            if (IsExpand)
            {
                this.gbList.OptionsView.ShowGroupPanel = true;
            }
            else
            {
                this.gbList.OptionsView.ShowGroupPanel = false;
            }
        }

        public delegate void ClosedHander(object sender);

        public delegate void SalaryPayChangedHander(object sender);
    }
}

